<template>
	<view class="suggest-parent">
		<textarea class="suggest-content" placeholder="请输入您投诉和建议的内容，或者联系客服微信：shiqinvip" :value="inputContent" @input="areaInput"/>
		<text class="tijiao" @click="submit">提交</text>
		<LoginTipDialog :isShow="isShowLoginTip" dataSource="登录查看具体信息"  @returnLoginTipDialog="returnLoginTipDialog"/>
	</view>
</template>

<script>
	import request from '../index/request.js';
	import LoginTipDialog from "@/components/login-tip-dialog/login-tip-dialog.vue";
	export default {
		components: {
			LoginTipDialog
		},
		data() {
			return {
				inputContent:"",
				isShowLoginTip:false,
			}
		},
		methods: {
			returnLoginTipDialog:function(e){
				this.isShowLoginTip=e.isclose
				if(e.tag){
					uni.navigateTo({
						url:"../index/index"
					})
				}
			},
			onLoad:function(options){
				this.appUtil.saveAppInviteId(options)
			},
			areaInput:function(event){
				this.inputContent=event.detail.value
			},
			onShow:function(){
				var user = uni.getStorageSync("shiqin-user")
				this.share.url='/pages/tabBar/home/index?appInviteId='+this.appUtil.getAppInviteId()
				this.share.shareType=1
				if(!user.PQD){
					this.isShowLoginTip=true
				}
			},
			submit:function(){
				var that=this
				var user = uni.getStorageSync("shiqin-user")
				if(user.PQD){
					request.post("api/user/add_suggest",{
						content:this.inputContent
					}).then(data=>{
						uni.showToast({
							icon:"none",
							title:"提交成功，我们会尽快处理您的问题"
						})
						setTimeout(() => {uni.navigateBack()}, 1000)
					})
				}else{
					this.isShowLoginTip=true
				}
			}
		}
	}
</script>

<style>
	@import "index.css";
</style>
